home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Text⁄Files
/
Voyeur 1.1.1
/
Voyeur ƒ
/
v code ƒ
/
v graphics.c
< prev
next >
Wrap
Text File
|
1994-02-26
|
3KB
|
105 lines
/**********************************************************************\
File: v graphics.c
Purpose: This module handles drawing the main window (the actual
graphics part of displaying the file data).
Voyeur -- a no-frills file viewer
Copyright ©1993-4, Mark Pilgrim
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program in a file named "GNU General Public License".
If not, write to the Free Software Foundation, 675 Mass Ave,
Cambridge, MA 02139, USA.
\**********************************************************************/
#include "v graphics.h"
#include "v.h"
#include "program globals.h"
#include "v hex.h"
#include "msg graphics.h"
void DrawTheWindowColor(int index)
{
RGBColor oldForeColor, oldBackColor;
GetForeColor(&oldForeColor);
GetBackColor(&oldBackColor);
DrawTheWindowBW(index);
RGBForeColor(&oldForeColor);
RGBBackColor(&oldBackColor);
}
void DrawTheWindowBW(int index)
{
GrafPtr curPort;
int i,j;
int temp;
Rect invertRect;
Str255 tempStr;
GetPort(&curPort);
EraseRect(&(curPort->portRect));
TextFont(monaco);
TextSize(9);
for (i=0; i<16; i++)
{
temp=i*16;
MoveTo(10,15+i*12);
DrawChar(hexchar[1][i]);
DrawString("\p0: ");
for (j=0; j<16; j++)
{
DrawChar(hexchar[0][gTheBuffer[index][temp+j]]);
DrawChar(hexchar[1][gTheBuffer[index][temp+j]]);
DrawChar(' ');
}
DrawChar(' ');
for (j=0; j<16; j++)
{
DrawChar(asciichar[gTheBuffer[index][temp+j]]);
}
}
invertRect.top=6+12*(gBufferOffset[index]/16);
invertRect.bottom=invertRect.top+11;
invertRect.left=38+18*(gBufferOffset[index]%16);
invertRect.right=invertRect.left+15;
InvertRect(&invertRect);
invertRect.left=333+6*(gBufferOffset[index]%16);
invertRect.right=invertRect.left+7;
InvertRect(&invertRect);
MoveTo(10, 219);
DrawString("\pOffset: ");
LongToHexString(gTheOffset[index][gWhichFork[index]], tempStr);
DrawString(tempStr);
DrawString("\p Total length: ");
LongToHexString(gForkLength[index][gWhichFork[index]], tempStr);
DrawString(tempStr);
DrawString("\p ");
if (gWhichFork[index]==0)
DrawString("\pData");
else
DrawString("\pResource");
DrawString("\p fork");
}